

#include "Losu_Std.h"
#include<iostream>
#include<string>
#include<ctime>
#include<thread>
#include<vector>
using namespace std;
extern "C"{
extern LNI_return rt;
extern string rtstr;

LNI_return Els_Time_day(LNI_argv a){
    time_t t;
    rt.type = ELS_TYPE_NUMBER;
    time(&t);
    rt.num =  localtime(&t) -> tm_mday;
    return rt;
}
LNI_return Els_Time_mon(LNI_argv a){
    time_t t;
    rt.type = ELS_TYPE_NUMBER;
    time(&t);
    rt.num =  localtime(&t) -> tm_mon+1;
    return rt;
}
LNI_return Els_Time_year(LNI_argv a){
    time_t t;
    rt.type = ELS_TYPE_NUMBER;
    time(&t);
    rt.num = (localtime(&t) -> tm_year) +1900;
    return rt;
}
LNI_return Els_Time_today(LNI_argv a){
    time_t t;
    rt.type = ELS_TYPE_NUMBER;
    time(&t);
    rt.num =  localtime(&t) -> tm_wday;
    return rt;
}
LNI_return Els_Time_hour(LNI_argv a){
    time_t t;
    rt.type = ELS_TYPE_NUMBER;
    time(&t);
    rt.num =  localtime(&t) -> tm_hour;
    return rt;
}
LNI_return Els_Time_min(LNI_argv a){
    time_t t;
    rt.type = ELS_TYPE_NUMBER;
    time(&t);
    rt.num =  localtime(&t) -> tm_min;
    return rt;
}
LNI_return Els_Time_sec(LNI_argv a){
    time_t t;
    rt.type = ELS_TYPE_NUMBER;
    time(&t);
    rt.num =  localtime(&t) -> tm_sec;
    return rt;
}
LNI_return Els_Time_clock(LNI_argv a){
    rt.type = ELS_TYPE_NUMBER;
    rt.num =  clock();
    return rt;
}
LNI_return Els_Time_sleep(LNI_argv a){
    rt.type = ELS_TYPE_NULL;
    std::this_thread::sleep_for(std::chrono::seconds((int)a.num[3]));
    return rt;
}
LNI_return Els_Time_sleepms(LNI_argv a){
    rt.type = ELS_TYPE_NULL;
    std::this_thread::sleep_for(std::chrono::milliseconds((int)a.num[3]));
    return rt;
}
}